Query-based generation of data records

ABSTRACT

A method and apparatus for generating at least one data record in respect to a database query comprising a fetch command. A database may be updated according to the at least one data record. In an exemplary embodiment, a database management system may be tested by performing the database query against the database. In another exemplary embodiment, a data record that satisfies the database query is generated in order to increase coverage when testing a database management system.

BACKGROUND

The present disclosure relates to database management systems ingeneral, and to testing database management systems, in particular.

In the computerized environment surrounding us, data stored in computingdevices becomes more and more vital to our everyday life, and the needto store that data in a reliable database is ever more crucial. Variousdatabase management systems (DBMS), known in the art, such as MicrosoftSQL server, IBM DB2, Oracle database and others. Each DBMS employsdifferent algorithms to store data records in a database, to provide areliable storage means, and to enable a retrieval of relevant datarecords upon request. A DBMS may use various database models such as anetwork model or a relational model to describe the structure of adatabase. A DBMS may provide a user of the DBMS with a schema of thedatabase which does not depend on the method of physically organizingthe data records in the database. Some DBMSs may use decentralizedalgorithms for retrieving data records from the database. Some DBMSs mayoptimize their performance according to specialized optimizations whichmay take into account, for example, statistical information of the datarecords being stored in the database. Other optimizations may affect ause of an index for fast retrieval, an access path to retrieve datarecords, an order in which to examine different data structures, such asdata tables, a strategy of joining different data structures and thelike.

BRIEF SUMMARY OF THE INVENTION

One exemplary embodiment of the disclosed subject matter is acomputerized apparatus comprising: an interface for receiving a firstdatabase query, the first database query comprises a fetch command; anda data generation module for generating at least one data record; the atleast one data record satisfies at least a portion of a second databasequery associated with the fetch command.

Another exemplary embodiment of the disclosed subject matter is a methodcomprising: receiving a first database query; the database querycomprises a fetch command; generating at least one data record; the atleast one data record satisfies at least a portion of a second databasequery associated with the fetch command; and storing the at least onedata record in a database having an initial state; whereby modifying astate of the database; and whereby a database management system whichperforms the first database query behaves differently with respect tothe database than in respect to the initial state of the database.

Yet another exemplary embodiment of the disclosed subject matter is acomputer program product for generating at least one data record, thecomputer program product comprising: a computer readable medium; firstprogram instructions to receive a first database query; the firstdatabase query comprising a fetch command; second program instructionsto generate at least one data record; the at least one data recordsatisfies at least a portion of a second database query associated withthe fetch command; and wherein the first and second program instructionsare stored on the computer readable media.

THE BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The present disclosed subject matter will be understood and appreciatedmore fully from the following detailed description taken in conjunctionwith the drawings in which corresponding or like numerals or charactersindicate corresponding or like components. Unless indicated otherwise,the drawings provide exemplary embodiments or aspects of the disclosureand do not limit the scope of the disclosure. In the drawings:

FIG. 1 shows a typical computerized environment in which the disclosedsubject matter is used, in accordance with some exemplary embodiments ofthe subject matter;

FIG. 2 shows a block diagram of a data generation module, in accordancewith some aspects of the disclosed subject matter;

FIG. 3 shows a flowchart of a method for testing a DBMS, in accordancewith some aspects of the disclosed subject matter; and

FIG. 4 shows a flowchart of a method for batch testing a DBMS, inaccordance with some aspects of the disclosed subject matter.

DETAILED DESCRIPTION

The disclosed subject matter is described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of thesubject matter. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in acomputer-readable medium that can direct a computer or otherprogrammable data processing apparatus to function in a particularmanner, such that the instructions stored in the computer-readablemedium produce an article of manufacture including instruction meanswhich implement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer orother programmable data processing apparatus to cause a series ofoperational steps to be performed on the computer or other programmableapparatus to produce a computer implemented process such that theinstructions which execute on the computer or other programmableapparatus provide processes for implementing the functions/actsspecified in the flowchart and/or block diagram block or blocks.

One technical problem dealt with by the disclosed subject matter is toavoid testing of a DBMS with database queries that have no result due toa content of a database. Another technical problem dealt with by thedisclosed subject matter is to enable testing of a DBMS withoutproviding a testing unit with an existing database; as such a databasemay be unavailable due to various reasons. For example, in case theexisting database contains sensitive information or is subject to rules,guidelines or internal regulations that forbids disclosure of a contentof the database to other personnel, as is sometimes the case when anerror occurs in a client's computerized site. Other reasons for theunavailability of the database may be that it does not exist anywhere orwas not compiled or gathered. Yet another technical problem dealt withby the disclosed subject matter is to enable benchmark testing of a DBMSto determine a quality level of the DBMS by testing an execution of aset of database queries by the DBMS.

One technical solution is to provide a data generation module togenerate data records in relation to a database query. Another technicalsolution is to provide a testing module to test the execution of theDBMS by updating a content of a database with data records that weregenerated in respect to the DBMS as well as executing a database queryand inspecting the performance of the DBMS. Yet another technicalsolution is to provide a query obtainer for obtaining a database queryto be used to test the DBMS and generate a data record in the databasein respect to the database query. The term obtaining may also refer toreceiving, retrieving, assembling generating or a combination thereof.An additional technical solution is to generate a set of constraintswhich relate to a database query to be used to test the DBMS. In someexemplary embodiments of the disclosed subject matter, a data record isgenerated based on a solution of the set of constraints that aconstraint satisfaction solver provided.

One technical effect of utilizing the disclosed subject matter ismodifying a content of a database in relation to a database query insuch a way that a result of a database query on an original database isdifferent from a result of the database query on a modified database.Another technical effect is modifying a computer readable medium tocontain a set of constraints relating to a database query. Yet anothertechnical effect is obtaining information about execution of a DBMS withregard to a database query. An additional technical effect is to ensurethat a predetermined instruction set of the DBMS is executed. Forexample, if a database does not contain any data record that should bereturned as a result of a database query, an optimization performed bythe DBMS may determine that not all the constraints forced by thedatabase query should be examined.

Referring now to FIG. 1 showing a typical computerized environment inwhich the disclosed subject matter is used, in accordance with someexemplary embodiments of the subject matter. A computerized environment100 comprises a database (DB) 120 and a database management system(DBMS) 110. In some exemplary embodiments of the disclosed subjectmatter, the DB 120 is a logical representation of the physical manner inwhich data is stored in a computer readable medium. It will be notedthat the DB 120 may be a centralized or decentralized database using anykind of computer readable memory to store data, may comprise one or moreservers or other computerized apparatuses and the like. The DBMS 110 maymanipulate the DB 120 according to a user request (not shown). Forexample, updating the DB 120 or retrieving data records from the DB 120.The user request may be formed in a query language such as but notlimited to SQL, XQuery, OQL and the like.

The DBMS 110 may further comprise an optimization module 115 foroptimizing the performance of the DBMS 110 according to variousoptimization algorithms. In some exemplary DBMSs 110, the optimizationmodule 115 may provide an optimization according to parameters such asthe content of the DB 120, the user request, resources available to theDBMS 110 such as memory, CPU, communication bandwidth, servers and thelike. The optimization may further depend on statistical informationregarding a content of the DB 120, logical operations requested to beperformed according to the user request, indexing of the DB 120,estimated number of data records that the user request addresses and thelike.

The computerized environment 100 may further comprise a testing module140 and/or a query obtainer 150. The testing module 140 performs testingor other quality assurance (QA) operations to detect bugs in the DBMS110 or other quality measurements such as but not limited to performanceof the DBMS 110. The query obtainer 150 obtains a database queryformalized in a query language that is compatible, either directly orindirectly via translation, compilation, interpretation, modificationand the like, with the DBMS 110.

In some exemplary embodiments of the disclosed subject matter, thedatabase query is a fetch command such as selection of data records,selection of data fields, selection of a portion of a schema, and thelike; a data manipulation command such as insertion, deletion, update,merge and the like; a transaction control command such as commit,rollback and the like; a data definition command such as definition ofschema, redefinition of schema, manipulation of data objects within aschema, altering a schema or data objects and the like; a data controlcommand such as granting or revoking authorization, and the like. Insome exemplary embodiments of the disclosed subject matter, a databasequery is a combination of one or more database commands. For example, adata manipulation command may manipulate a data record that is fetchedusing a fetch command. In the SQL query language one exemplary databasequery which comprises a fetch command and a data manipulation commandmay be “update T set a=10 where b>10”, where data records of table T arefetched according to the value of field “b” and their value in field “a”is modified.

In some exemplary embodiments of the disclosed subject matter, the queryobtainer 150 may receive the database query from a user 180, such as butnot limited to a developer of the DBMS 110 or a QA personnel of the DBMS110, using a terminal 170 or other man-machine interface. The databasequery (not shown) may comprise a database query which the user 180designed to execute a predetermined instructions of the DBMS 110, forexample an instruction of the optimization module 115. The databasequery may be a query that has caused a problematic behavior of the DBMS110 in the past, for example a query utilized by a user (not shown) ofthe DBMS 110 and returned erroneous results or performed otherwisepoorly.

In some other exemplary embodiments of the disclosed subject matter, thequery obtainer 150 receives the database query from a query generator160. The query generator 160 may generate the database query randomly,for example, using a parse tree of the query language and traversing itrandomly or stochastically. In yet other exemplary embodiments of thedisclosed subject matter, the query obtainer 150 may receive thedatabase query from a database query server (not shown), a databasequery database (not shown), a third-party benchmark module (not shown)and the like. In some exemplary embodiments, the query obtainer 150 maybe configured to passively receive the database query. In otherexemplary embodiments, the query obtainer 150 actively acquires thedatabase query.

In some exemplary embodiments of the disclosed subject matter, thetesting module 140 provides a data generation module 130 with thedatabase query. The data generation module 130 may generate or otherwiseobtains data records such that will affect a behavior of the DBMS 110that handles the database query.

In some exemplary embodiments of the disclosed subject matter, the datageneration module 130 generates exactly one data record for which allthe constraints formulated by the database query are satisfied. In otherexemplary embodiments of the disclosed subject matter, the datageneration module 130 generates more than one data record, for exampleten different data records, for which a subset of a set of constraintsformulated in the database query are satisfied. It will be noted thatthe subset may be exactly the set of constraints or any strict subset ofthe set of constraints. In yet other exemplary embodiments of thedisclosed subject matter, the data generation module 130 generates adata record that satisfies a portion of a second database queryassociated with the database query. The term associated may also meanthat one query is equivalent, complementing, excluding, including, orotherwise being logically connected, or a combination of the above, toat least a portion second query. In some exemplary embodiments of thedisclosed subject matter, an associated database query may be compiled,gathered, calculated, determined or otherwise obtained by attributingone or more subsets of a set of constraints formulated by a databasequery with one or more logical operations, such as negation,equivalence, complementation, inclusion, exclusion and the like. It willbe noted that in some exemplary embodiments the second database query isequivalent to the database query.

In an exemplary embodiment of the disclosed subject matter, the datageneration module 130 retrieves at least one data record from anindependent database (not shown) such that the at least one data recordrelates to the database query. For example, the independent database maybe a third-party benchmark database that contains a substantiallyequivalent schema to the schema of the DB 120. In some exemplaryembodiments of the disclosed subject matter, the data generation module130 receives additional information from a user, such as the user 180,to define a domain of a data field in a data record within the DB 120.The data generation module 130 may receive such additional informationfrom an independent DB (not shown) such as a database on which thedatabase query was originally performed. The data generation module 130may update the DB 120 directly or indirectly through a DBMS such as DBMS110 or by other equivalent means, to include data records that the datageneration module 130 generated or retrieved. In other exemplaryembodiments of the disclosed subject matter, the data generation module130 may purge the DB 120 such that it contains no other data recordsexcept those the data generation module 130 generated. In yet otherexemplary embodiments of the disclosed subject matter, the datageneration module 130 may update the DB 120 such that it does notcontain data records generated or retrieved by the data generationmodule 130.

FIG. 2 shows a block diagram of a data generation module, in accordancewith some aspects of the disclosed subject matter. A data generationmodule 200, such as 130 of FIG. 1, contains a processor 210 and aninput/output device (I/O) 240. The I/O 240 may be utilized to receivedata records from an independent database (not shown). The I/O 240 mayfurther be utilized to perform operations on a designated database, suchas DB 120 of FIG. 1. Some exemplary operations to be performed on thedesignated database may be an update operation, insertion of a datarecord, deletion of a data record, joining of several data structuresand the like. The I/O 240 may additionally be utilized to receive adatabase query for which the data generation module 200 generates a datarecord. In some exemplary embodiments, the I/O 240 may receiveinformation used to define a domain of at least one data field of thedata record. For example, given a schema comprising a table “T” havingtwo integer fields “a” and “b”, a domain of “a” may be limited toinclude only integers of a specific range such as 0 . . . 100 or of aspecific set such as {0,1,2,10,20,200}. The above domains are disclosedas exemplary domains only and other domains may be apparent to a personskilled in the art.

In response to receiving a database query, the data generation module200 may utilize a constraints generator 230 to formulate a set ofconstraints in respect to the database query. For example, given an SQLdatabase query of the form “select * from T where a>7”, a set ofconstraints may be a single constraint formulating that the field “a” oftable “T” must be greater than 7. The set of constraints may relate tomore than one data record. For example, again relating to the aboveexemplary SQL database query, a set of constraints may be “(a0>7) and(a1>7) and (a0≠a1)” where a0 relates to an “a” field of a first datarecord and a1 relates to an “a” field of a second data record. It willbe noted that a0 and a1 may be stored in a single vector, for examplevector a, or otherwise coupled together. Given two data records in adatabase that satisfy the aforementioned exemplary set of constraints, aDBMS (not shown) should at least provide that two data records as aresult of performing the above exemplary SQL database query. Additionalexample may be in case a subquery is used, for example an SQL databasequery of the form “select * from T where a>7 and exists (select * from Twhere a<7)” may be formulated into a set of constraints such as “(a0>7)and (a1<7)”. The constraints generator 230 may generate an original setof constraints such that a data record that relates to the databasequery satisfies the original set of constraints. The constraintsgenerator 230 may further generate a second set of constraints such thata data record for which the second set of constraints is satisfied,satisfies a first subset of the original set of constraints and does notsatisfy a second subset of the original set of constraints. Theconstraints generator 230 may generate a set of constraints according topredetermined characteristics, user decisions, heuristically-guidedalgorithms, database content and the like.

A constraint satisfaction solver 220 may be utilized to provide a datarecord that satisfies a subset of the set of constraints. In someexemplary embodiments, the constraint satisfaction solver 220 may be aninterface to a third-party constraint satisfaction solver. In anexemplary embodiment of the disclosed subject matter, the constraintsgenerator 230 generates a constraint satisfaction problem (CSP), aBoolean satisfiability problem (SAT) or the like. In some exemplaryembodiments of the disclosed subject matter the constraint satisfactionsolver 220 is a CSP solver, a SAT solver, a theorem prover, an integerlinear programming solver or the like. In some exemplary embodiments ofthe disclosed subject matter, a CSP solver is utilized to solve a CSPthat is defined using a triple <V,D,C> where V is a set of variables, Dis a domain for each variable, and C is a set of constraints on thevalues of the variables. In some exemplary embodiments of the disclosedsubject matter, each field of each data record is assigned a variable inthe CSP. In other exemplary embodiments, some fields are not assigned avariable and their value is calculated, generated or chosen without theuse of the CSP solver. For example, if a field of a data record is not asubject of a constraint, its value may be randomly chosen from anappropriate domain.

FIG. 3 shows a flowchart of a method for testing a DBMS, in accordancewith some aspects of the disclosed subject matter.

In step 310, a database query is obtained. In some exemplary embodimentsof the disclosed subject matter, a query obtainer, such as 150 of FIG.1, is utilized to obtain the database query.

In step 320, a data record is generated or retrieved in respect to thedatabase query. In some exemplary embodiments of the disclosed subjectmatter, a data generation module, such as 130 of FIG. 1, is utilized togenerate the data record. In some exemplary embodiments, the data recordis stored within a computer readable medium. More than one data recordmay be generated or received. A first portion of the more than one datarecord may be characterized in that it complies with a set ofconstraints forced by the database query. A second portion of the morethan one data record may be characterized in that it complies with afirst subset of the set of constraints forced by the database query anddoes not comply with a second subset. Additional portions of the morethan one data record may be characterized in a similar manner.

In some exemplary embodiments of the disclosed subject matter, the datarecord is generated in step 320 in order to force an execution of apredetermined or otherwise selected instruction of the DBMS, for examplea specific optimization instruction. In other exemplary embodiments ofthe disclosed subject matter, the data record is generated in step 320in order to verify the existence of at least one data record compliantwith the constraints formulated by the database query. In yet otherexemplary embodiments of the disclosed subject matter, the data recordis generated in step 320 in order to verify that a portion of the datarecords in the database comply with the constraints formulated by thedatabase query.

In step 330, a database may be updated to include the data recordgenerated in step 320. The database may be purged of other data recordssuch that it will only contain the data records generated in step 320.In other exemplary embodiments of the disclosed subject matter, anoriginal content of the database is otherwise modified. In yet otherexemplary embodiments of the disclosed subject matter, the originalcontent of the database is not changed and the data record generated instep 320 is inserted to the database in addition to the originalcontent. In an exemplary embodiment of the disclosed subject matter adatabase updating module is utilized to update a database. Step 330 maybe performed using a DBMS or by directly modifying the database.

In step 340, a module, such as testing module 140 of FIG. 1, initiatesthe database query against the database using a DBMS. In some exemplaryembodiments of the disclosed subject matter, the result returned by theDBMS is received or otherwise collected by a module such as a testingmodule 140 of FIG. 1.

In step 350, the results returned by the DBMS are evaluated to determinewhether the operation of the DBMS was correct. In some exemplaryembodiments of the disclosed subject matter, the data record generatedin step 320 and inserted to the database in step 330, requires there tobe at least a predetermined number of results to the database query. Inother exemplary embodiments, the data record requires there to be atmost a predetermined number of results or an exact number of results. Insome exemplary embodiments of the disclosed subject matter, the numberof returned data records may be inspected to determine whether the DBMSperformed as expected. In other exemplary embodiments, a performancemeasurement of the DBMS may be inspected, such as the amount of timepassed until the query results were determined, amount of resourcesrequired by the DBMS to perform and the like. In yet other exemplaryembodiments, the method examines whether a catastrophical erroroccurred, such as a deadlock, a use of dangling pointer, division byzero, failing assertion and the like.

FIG. 4 shows a flowchart of a method for batch testing a DBMS, inaccordance with some aspects of the disclosed subject matter.

In step 410 a database query is generated by a query generator such as160 of FIG. 1.

In step 420 a set of constraints in respect to the database query isgenerated by a constraints generator such as 230 of FIG. 2.

In step 430 a first data record for which the set of constraints issatisfied is obtained, retrieved or generated using a constraintsatisfaction solver such as 220 of FIG. 2.

In step 440, a second data record is obtained for which a first subsetof the set of constraints is satisfied and a second subset of the set ofconstraints is not satisfied. In some exemplary embodiments of thedisclosed subject matter, a modified set of constraints is generatedusing the constraints generator such that a data record satisfying themodified set of constraint also satisfies the first subset of the set ofconstraints and does not satisfy a second subset of the set ofconstraints. In some exemplary embodiments, the modified set ofconstraints is formulated such that at least a portion of the secondsubset is not satisfied. In an exemplary embodiment of the disclosedsubject matter the constraint satisfaction solver is utilized to obtain,retrieve or generate the second data subset based upon the modified setof constraints.

In step 450, a database is updated to include the first data record andsecond data record. In some exemplary embodiments the database isupdated as aforementioned disclosed regarding step 330 of FIG. 3.

In step 460, the database query is performed using a first DBMS.

In step 470, the database query is performed using a second DBMS. Insome exemplary embodiments of the disclosed subject matter, one of thefirst DBMS and second DBMS is a DBMS being tested and the other is areliable DBMS being used to compare results with the DBMS being tested.It will be noted that the reliable DBMS may be a third-party DBMS, aprevious version of the DBMS being tested such as a reliable and stableversion, a DBMS being tested which does not execute a predeterminedinstruction, a DBMS being tested for which a predetermined optimizationalgorithm is turned off, and the like.

In step 480, query results returned by the first DBMS and the secondDBMS are compared to determine that the DBMS being tested is functioningas expected. It will be noted that in some exemplary embodiments of thedisclosed subject matter, step 470 may be optional and in step 480 anevaluation of the query results returned by the first DBMS may beperformed in a similar manner to that disclosed with relation to step350 of FIG. 3.

In step 490, a determination whether to continue testing is made. Incase the testing ended, for example because all possible databasequeries were tested, due to user request, predetermined time limitreached, a predetermined number of erroneous behaviors have beendetected and the like, the method ends in step 499. In case additionaltesting is determined to be performed, step 495 may be performed torollback the database to its state before updating was performed in step450. In case the DBMS being tested does not support rollback operationsdirectly, the functionality may be achieved in other methods such asstoring an original content of the database before step 450 and updatingit again to store the original content in step 495. In some exemplaryembodiments of the disclosed subject matter, rollback may be skipped,for example in order to provide a database with many data records.

In step 410 a different database query may be generated, obtained orretrieved in order to be tested. In some exemplary embodiments of thedisclosed subject matter, a database query may be tested several timesagainst several different states of the database. For example, it may bedesirable to test the DBMS performance and result in regard to adatabase query when a predetermined number of results are contained inthe database, when the database has a predetermined amount of datarecords, for example one million, when the number of result that arecontained in the database is a predetermined portion of a total datarecords in the database, for example 5%, and the like.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof program code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

As will be appreciated by one skilled in the art, the disclosed subjectmatter may be embodied as a system, method or computer program product.Accordingly, the disclosed subject matter may take the form of anentirely hardware embodiment, an entirely software embodiment (includingfirmware, resident software, micro-code, etc.) or an embodimentcombining software and hardware aspects that may all generally bereferred to herein as a “circuit,” “module” or “system.” Furthermore,the present invention may take the form of a computer program productembodied in any tangible medium of expression having computer-usableprogram code embodied in the medium.

Any combination of one or more computer usable or computer readablemedium(s) may be utilized. The computer-usable or computer-readablemedium may be, for example but not limited to, an electronic, magnetic,optical, electromagnetic, infrared, or semiconductor system, apparatus,device, or propagation medium. More specific examples (a non-exhaustivelist) of the computer-readable medium would include the following: anelectrical connection having one or more wires, a portable computerdiskette, a hard disk, a random access memory (RAM), a read-only memory(ROM), an erasable programmable read-only memory (EPROM or Flashmemory), an optical fiber, a portable compact disc read-only memory(CDROM), an optical storage device, a transmission media such as thosesupporting the Internet or an intranet, or a magnetic storage device.Note that the computer-usable or computer-readable medium could even bepaper or another suitable medium upon which the program is printed, asthe program can be electronically captured, via, for instance, opticalscanning of the paper or other medium, then compiled, interpreted, orotherwise processed in a suitable manner, if necessary, and then storedin a computer memory. In the context of this document, a computer-usableor computer-readable medium may be any medium that can contain, store,communicate, propagate, or transport the program for use by or inconnection with the instruction execution system, apparatus, or device.The computer-usable medium may include a propagated data signal with thecomputer-usable program code embodied therewith, either in baseband oras part of a carrier wave. The computer usable program code may betransmitted using any appropriate medium, including but not limited towireless, wireline, optical fiber cable, RF, and the like.

Computer program code for carrying out operations of the presentinvention may be written in any combination of one or more programminglanguages, including an object oriented programming language such asJava, Smalltalk, C++ or the like and conventional procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The program code may execute entirely on the user's computer,partly on the user's computer, as a stand-alone software package, partlyon the user's computer and partly on a remote computer or entirely onthe remote computer or server. In the latter scenario, the remotecomputer may be connected to the user's computer through any type ofnetwork, including a local area network (LAN) or a wide area network(WAN), or the connection may be made to an external computer (forexample, through the Internet using an Internet Service Provider).

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present invention has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the invention. Theembodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

1. A computer-implemented method performed by a processor, the methodcomprising: testing a database management system of a database by:generating in the database at least one data record based on a databasequery to the database management system, so that upon execution of thedatabase query by the database management system the at least one datarecord is involved in processing the database query; wherein saidgenerating comprises: identifying a set of constraints in the databasequery; determining a satisfaction problem of a data record that ischaracterized in satisfying at least a portion of the set ofconstraints; solving the satisfaction problem using a satisfactionproblem solver, thereby determining the data record, wherein thesatisfaction solver is selected from a group consisting of: a ConstraintSatisfaction Problem (CSP) solver, a Boolean satisfiability problem(SAT) solver, a theorem prover, and a linear programming solver; andupdating the database to include the data record; performing thedatabase query by the database management system, wherein operation ofthe database management system is affected by the database retaining theat least one data record; and whereby the database management system istested with respect to the database query.
 2. The computer-implementedmethod of claim 1, wherein the database management system is operativenot to update the database in response to the database query, wherebysaid testing causes a modification to the database that does not flowfrom the database query.
 3. The computer-implemented method of claim 1,wherein the set of constraints relates to a subquery of the databasequery.
 4. The computer-implemented method of claim 1, wherein saiddetermining the CSP comprises determining a CSP of a plurality of datarecords that are characterized in satisfying different portions of theset of constraints; thereby solving the CSP determines the plurality ofdata records; and said updating comprises updating the database toinclude the plurality of data records.
 5. The computer-implementedmethod of claim 1, wherein the data record is operative to ensure thatthe database management system will execute a predetermined instructionin response to the database query.
 6. The computer-implemented method ofclaim 5, wherein the predetermined instruction is an optimizationinstruction, whereby said testing tests operation of the optimizationinstruction.
 7. The computer-implemented method of claim 1, wherein saidtesting further comprises comparing a result of said performing thedatabase query by the database management system with an expectedresult.
 8. The computer-implemented method of claim 7, wherein saidtesting further comprises performing the database query upon thedatabase using a second database management system thereby obtaining theexpected result.
 9. The computer-implemented method of claim 1, whereinthe satisfaction problem is a Constraint Satisfaction Problem (CSP), andwherein the satisfaction solver is a CSP solver.
 10. A computerizedapparatus comprising: a processor which is arranged to: test a databasemanagement system of a database by: generating in the database at leastone data record based on a database query to the database managementsystem, so that upon execution of the database query by the databasemanagement system the at least one data record is involved in processingthe database query; wherein said generating comprises: identifying a setof constraints in the database query; determining a satisfaction problemof a data record that is characterized in satisfying at least a portionof the set of constraints; solving the satisfaction problem using asatisfaction problem solver, thereby determining the data record,wherein the satisfaction solver is selected from a group consisting of:a Constraint Satisfaction Problem (CSP) solver, a Boolean satisfiabilityproblem (SAT) solver, a theorem prover, and a linear programming solver;and updating the database to include the data record; and performing thedatabase query by the database management system, wherein operation ofthe database management system is affected by the database retaining theat least one data record.
 11. The computerized apparatus of claim 10,wherein the database management system is operative not to update thedatabase in response to the database query, whereby said processor isconfigured to cause, during testing, a modification to the database thatdoes not flow from the database query.
 12. The computerized apparatus ofclaim 10, wherein the set of constraints relates to a subquery of thedatabase query.
 13. The computerized apparatus of claim 10, wherein saiddetermining the CSP comprises determining a CSP of a plurality of datarecords that are characterized in satisfying different portions of theset of constraints; thereby solving the CSP determines the plurality ofdata records; and said updating comprises updating the database toinclude the plurality of data records.
 14. The computerized apparatus ofclaim 10, wherein the data record is operative to ensure that thedatabase management system will execute a predetermined instruction inresponse to the database query.
 15. The computerized apparatus of claim14, wherein the predetermined instruction is an optimizationinstruction, whereby said processor is arranged to test operation of theoptimization instruction.
 16. The computerized apparatus of claim 10,wherein said processor is arranged to perform the testing by comparing aresult of said performing the database query by the database managementsystem with an expected result.
 17. The computerized apparatus of claim16, wherein said processor is arranged to perform the testing byperforming the database query upon the database using a second databasemanagement system thereby obtaining the expected result.
 18. Thecomputerized apparatus of claim 10, wherein the satisfaction problem isselected from the group consisting of: a Constraint Satisfaction Problem(CSP) and a Boolean satisfiability problem (SAT).
 19. A computer programproduct, said computer program product comprising: a non-transitorycomputer readable medium, in which computer instructions are stored,which instructions, when read by a computer, cause the computer to: testa database management system of a database by: generating in thedatabase at least one data record based on a database query to thedatabase management system, so that upon execution of the database queryby the database management system the at least one data record isinvolved in processing the database query; wherein said generatingcomprises: identifying a set of constraints in the database query;determining a satisfaction problem of a data record that ischaracterized in satisfying at least a portion of the set ofconstraints; solving the satisfaction problem using a satisfactionproblem solver, thereby determining the data record, wherein thesatisfaction solver is selected from a group consisting of: a ConstraintSatisfaction Problem (CSP) solver, a Boolean satisfiability problem(SAT) solver, a theorem prover, and a linear programming solver; andupdating the database to include the data record; and performing thedatabase query by the database management system, wherein operation ofthe database management system is affected by the database retaining theat least one data record.